<template>
  <div>
    <el-card>
      <el-form ref="form" :model="formData" size="medium" label-width="110px">
        <el-row type="flex" justify="center">
          <el-col :span="10">
            <el-form-item label="监督机构: " prop="orgName">
              <el-select v-model="formData.orgId" filterable clearable style="margin-left: 20px;" :style="{width: '60%'}" placeholder="请选择">
                <el-option
                  v-for="item in forname"
                  :key="item.id"
                  :label="item.orgName"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="el" >
          <el-col :span="8">
            <el-row >
              <el-col :span="8">
                <el-form-item label="科室编码" prop="divCode">
                  <el-input v-model="formData.divCode"  clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="el" >
              <el-col :span="8">
                <el-form-item label="电话号码" prop="dutyTel">
                  <el-input v-model="formData.dutyTel" clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="8">
            <el-row>
              <el-col :span="8">
                <el-form-item label="科室名称" prop="divName">
                  <el-input v-model="formData.divName" clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="el" >
              <el-col :span="8">
                <el-form-item label="传真号码" prop="fax">
                  <el-input v-model="formData.fax" clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="8">
            <el-row>
              <el-col :span="8">
                <el-form-item label="是否为分所" prop="ifSub">
                  <el-input v-model="formData.ifSub" clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="el" >
              <el-col :span=8>
                <el-form-item label="门号" prop="divRoomNo">
                  <el-input v-model="formData.divRoomNo" clearable :style="{width: '800%'}"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </el-form>
      <el-row type="flex" justify="center">
        <el-button type="success" @click="handlersave">保存</el-button>
        <el-button type="info" @click="$router.go(-1)">返回</el-button>
      </el-row>
    </el-card>
  </div>
</template>

<script>
  import {post} from "@/utils/api";

  export default {
    data() {
      return {
        sectionlist:[],
        page_show:true,
        formData:{},
        forname:[],
        orgid:0
      }
    },
    async created() {
      let res = await post("org/getallorg")
      // console.log(res)
      this.forname= res

    },
    methods: {
      async handlersave(){
        let res = await post("section/add",{...this.formData})
        console.log(res);
      },
    },
  }
</script>
<style>
  .el{
    margin-top: 20px;
  }
</style>
